﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace VSmityukh.WP.TitleLocalizationTool.Common
{
	internal static class Monad
	{
		public static TOut With<TIn, TOut>(this TIn item, Func<TIn, TOut> func, TOut defaultValue = default(TOut))
			where TIn : class
		{
			Guard.NotNull(func);

			if (item != null)
			{
				return func(item);
			}

			return defaultValue;
		}
	}
}
